{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Homework 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "#from cvxopt import matrix, solvers\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.svm import SVC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 加载数据函数\n",
    "def loadData(filename):\n",
    "    data = pd.read_csv(filename, sep='\\s+', header=None)\n",
    "    data = data.as_matrix()\n",
    "    col, row = data.shape\n",
    "    X = np.c_[np.ones((col, 1)), data[:, 1: row]]\n",
    "    Y = data[:, 0]\n",
    "    return X, Y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 误差计算函数\n",
    "def mistake(yhat, y):\n",
    "    err = np.sum(yhat != y)/len(y)\n",
    "    return err"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导入数据\n",
    "X, Y = loadData('features_train.dat')\n",
    "Xtest, Ytest = loadData('features_test.dat')\n",
    "row, col = X.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Q15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "w:  [[  0.00000000e+00   6.00766054e-05   3.95350000e-06]]\n",
      "w:  [[ 0.          0.00601009  0.00032659]]\n",
      "w:  [[ -1.77635684e-15   5.70727340e-01   2.59535779e-02]]\n",
      "w:  [[  0.          11.31692273   0.50277148]]\n",
      "w:  [[  1.45519152e-11   1.30809653e+01   5.78933050e-01]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAA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bRH7f\nAf4mEaML06IIRESka+lyaEhERLqgIhARSXMqAhGRNKciEBFJcyoCEZE0pyIQ6YKZHTyNdbPN7Ltm\n9oGZbTSzNWb2yXjmE4mXPvPNYpEk8x2gmMiMpE1mNhKYHTiTSKf0PQKRLpjZQXcfGP2G578QmULZ\ngX909yfMLAP4byIb+C1E9rAfAp4nMsHauETNDSMST9ojEDm5m4l8A3wKkW+frjWzFcAMoAw4DxhB\nZJrgh4CJwDaVgKQKnSMQObkrgMfcvc3ddwHlRGaxvQL4H3dvj87D9LuQIUVOlYpA5OQ6m0L5RPdv\nBkrNbFCC8ojElYpA5ORWAH9sZplmVgjMAtYAq4A/NLOM6MngOQDR2UcfBL4XnfAQMys2s88FSS9y\nEioCkZP7JfAmsAH4LfCN6KGgJ4lM0b0RuJ/I1aPqo+v8LZHrXbwTvSj60/TC9S9EToVGDYmcBjMb\n6O4HzWwYkb2EGclw3QaRntCoIZHT86yZFRC52NF3VAKSirRHICKS5nSOQEQkzakIRETSnIpARCTN\nqQhERNKcikBEJM39f6wAcIM39/pxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x215c13e1470>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Q15\n",
    "Ylabel = Y.copy()\n",
    "Ylabel[Ylabel != 0] = -1\n",
    "Ylabel[Ylabel == 0] = 1\n",
    "logC = [-6, -4, -2, 0, 2]\n",
    "w = []\n",
    "\n",
    "for i in range(len(logC)):\n",
    "    clf = SVC(C=pow(10,logC[i]), kernel='linear', shrinking=False)\n",
    "    clf.fit(X, Ylabel)\n",
    "    w.append(np.linalg.norm(clf.coef_))\n",
    "    print('w: ', clf.coef_)\n",
    "# plot\n",
    "plt.plot(logC, w)\n",
    "plt.xlabel('logC')\n",
    "plt.ylabel('||w||')\n",
    "plt.title('||w|| versus logC')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Q16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEWCAYAAABMoxE0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAGmtJREFUeJzt3X+0XWdd5/H3pwnpCIXWaS9Km2Lq\nNIwrCFzx0I6/qlB/tCwgiK1NzNQ6VKuuiWtmmBkt4s8WlQJO1bGjU1Y7q9MpbaGKXtSx6FRFRq29\nYQVMKJU7sZhLFAIthRo1xHznj72jp4ebe+69OzsnN3m/1jore+/n2ft8n2Tlfu6z9zl7p6qQJGml\nTpt0AZKk1c0gkSR1YpBIkjoxSCRJnRgkkqRODBJJUicGiU4JSbYlec+k6zgekvx+ku+edB06dRgk\nOmkkeTTJ3yZ5cuj1iwBVdVdVffOka1xtkjwvyTuTfDLJE0k+mOR1SdZMujadOAwSnWxeWVVnDL22\nT7qgI5KsnXQNy5HkXwAPAnuBF1TVmcCVwAB45iRr04nFINEpIcl3JXnf0Hol+b4kH0nyeJJbkmSB\n/c5tZzn/fGjbV7S/oT+tXX9tkofb49yf5EtG3uffJvkI8JE0bk7yiaHf8L+87fuUU1LDNS+235hx\nn5bkR5J8tN33fyY5c6j9O9u2TyX50XZW941t808Cf1RVr6uqvwKoqkeq6juq6tNL/svXSc8g0ans\nFcBLgBcB3w58y2iHqtoH/DHwbUObvwO4r6o+l+TVwA8DrwGmgD8E7h45zKuBi4FNwDcDlwDPA84C\nrgI+tYRaV7rfd7WvlwJfCpwB/CJAkk3AfwO2Ac8BzgTOG9r3G4H7lvAeOsUZJDrZ/FqSTw+9vmeR\nvm+qqk9X1V8CvwdMH6Xf24Gt0MwMgC3tNoDvBX6mqh6uqkPATwPTw7OStv2xqvpb4HM0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8P/CrbXD8aZLDNDdD23+86luqxcYxLMnbaM7Hn7CONpYkLwAu\nAD6QBJrTJ+9PclFV/fVxLHHJlvrvArwd+E1O4CAZN5Yk1wCvAC49EX/ZOmIZ/yar0Txw/tD6emBf\nX2/mqa2l+TXgZQBJngesYxXeGTTJc4ZWv5XmguKqU1V/VlXPrqoNVbWB5j/Ni0/UEBknycah1VcB\nH55ULV0luQz4IeBVVXVg0vWcwh4CNia5IMk6YAsw09ebOSNZmtuB25PsAg4C15zIv2kt4s1Jpmmm\nuI8C3zvZctR6U5J/CRymedzB9024ni5+ETgd+J12tvgnVbXqxpPkW4H/CkwBv5lkZ1V9y4TLWrKq\nOpRkO3A/sAa4vap29/V+3iJFktSJp7YkSZ0YJJKkTgwSSVInBokkqRODRJLUiUEi9SDJkx32fVqS\nNyX5SJJdSf40yeXHsj7pWPJ7JNKJ50bgOTR30f37JF8EfP2Ea5KOyu+RSD1I8mRVnZHmW3lvprmd\ndwFvrKp7k5xG8+W9rwf+gubswO3Ab9HcbO+CkbsCSycsZyRSv14DTAMvork/20NJ3gt8DbABeAHw\nbOBhmiC5EPhLQ0SriddIpH59LXB3Vf1DVX0c+AOaO0h/LfDOqjrc3iPs9yZZpNSFQSL1a6HbeS+2\nfQ54bpJn9lSPdMwZJFK/3gtclWRNkingEuBPgfcB35bktPZi+jcAtHfMvQ34hfaurSR5TpJ/PZHq\npSUwSKR+vQv4IPAB4AHgB9tTWb9Cc/v7XcB/Bx4Enmj3+RGaZ918qL3j9K9xAj77RjrCT21JE5Lk\njKp6MsnZNLOUr1mtz1TRqc1PbUmT8xtJzqJ5UNqNhohWK2ckkqROvEYiSerEIJEkdWKQSJI6MUgk\nSZ0YJJKkTv4/jnghJG4UBzkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x215c13e1400>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Q16\n",
    "Ylabel = Y.copy()\n",
    "Ylabel[Ylabel != 8] = -1\n",
    "Ylabel[Ylabel == 8] = 1\n",
    "logC = [-6, -4, -2, 0]\n",
    "Ein = []\n",
    "\n",
    "for i in range(len(logC)):\n",
    "    clf = SVC(C=pow(10,logC[i]), kernel='poly', degree=2, gamma=1, coef0=1, shrinking=False)\n",
    "    clf.fit(X, Ylabel)\n",
    "    Yhat = clf.predict(X)\n",
    "    Ein.append(mistake(Ylabel, Yhat))\n",
    "# plot\n",
    "plt.plot(logC, Ein)\n",
    "plt.xlabel('logC')\n",
    "plt.ylabel('Ein')\n",
    "plt.title('Ein versus logC')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Q17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3XmcFPWd//HXZw4Y7nNA7uEaoiGK\nikcUFbmi2awx5jC6Gl1jNCaaqLjZbLKPjVn38GcUjBqNJBrdxPuMURMZEfAgHuCJ4sxw3zBcww1z\nfH5/dKEDDjM9Q1d/e6bfz8eDx3RXV3W9e4B697equtrcHRERyV45oQOIiEhYKgIRkSynIhARyXIq\nAhGRLKciEBHJcioCEZEspyKQjGVmS81sQqrnbU3MrMjM3MzyQmeRlktFILEyszFmNsfMKs1sk5m9\nZmbHhc4l9TOz881srpltN7M1ZvZXMxsTOpfES0UgsTGzzsCzwO1Ad6Af8EtgT8hc6dLS3qWb2bXA\nrcD/AL2BgcCdwFdD5pL4qQgkTsUA7v6Qu9e4+y53n+7u7wOY2VAze8nMNprZBjN7wMy61vdEZna9\nmT1uZo+Y2TY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BdsxwGPuXhtdI2lm\nyJAih0JFINKw+i4H3ND0hcBAM+sUUx6RlFMRiDTsZeBcM8s1s0LgVOBN4FXg62aWEx0MHgsQXbHz\nHuC26KqRmFkfM7sgSHqRJKgIRBr2FPA+8B7wEvCTaFfQEyQunz0fuBt4A6iMlvl3Et918VF0xdun\nydDvvhABnTUk0mxm1tHdt5tZDxKjhJNb6ncqSHbTWUMizfesmXUl8UVHN6gEpKXSiEBEJMvpGIGI\nSJZTEYiIZDkVgYhIllMRiIhkORWBiEiW+/8oBbE7XpJjSgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x215bafa7f98>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Q17\n",
    "Ylabel = Y.copy()\n",
    "Ylabel[Ylabel != 8] = -1\n",
    "Ylabel[Ylabel == 8] = 1\n",
    "logC = [-6, -4, -2, 0]\n",
    "Salpha = []\n",
    "\n",
    "for i in range(len(logC)):\n",
    "    clf = SVC(C=pow(10,logC[i]), kernel='poly', degree=2, gamma=1, coef0=1, shrinking=False)\n",
    "    clf.fit(X, Ylabel)\n",
    "    Salpha.append(np.linalg.norm(clf.dual_coef_))\n",
    "# plot\n",
    "plt.plot(logC, Salpha)\n",
    "plt.xlabel('logC')\n",
    "plt.ylabel('Salpha')\n",
    "plt.title('Salpha versus logC')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Q18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEWCAYAAABxMXBSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJz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vFzxvCZwG5MQgSzQ/f8m8Y4H3SvsyVZW5jhg7uABYFONM0ZgM\nXBqcXXUKsP1Qt2SlqMozAarrA5hI5I/HPCKHnW2D9oHA/5RY7kdAbvC4vApy5RLpp5wTPA6dUdIG\nmBI870TkTI+5wEIiXSOh5wpejwSWEvl2WhW5LiLyTWs/kA+8XU32V7m5QtpfLYB3gWXBvylB++Hf\ne2AQMD/YX/OBH8cwz3/8/MDdRL6gACQDLwW/f18AnWK9j6LMdX/wuzQXeB/oUQWZXgDWAweD360f\nA1cBVwXvG/BEkHk+ZZxleCwPTTkiIiIVoq4qERGpEBUOERGpEBUOERGpEBUOERGpEBUOERGpEBUO\nkUpiZruOY91EM3sgmKl2gZl9YWYjKjOfSGWpM1eOi1Rz9wCtgd4emboiDRgcciaRo9J1HCKVxMx2\nuXujYMbW3wIjiMwPdK+7/9PM4oDHiRSEFUSO+J8FphC5oLKjf3OmZpFqSUccIpVvDNAXOAFoCXxp\nZtOJTNeRCWQTmYl2EZHC0QVYraIhNYXGOEQq3+lEZkstcvd84EPgxKD9JXcvdvcNRKanEKlxVDhE\nKl9pNxcqrT0XaH9o8kWR6k6FQ6TyTQe+Y2bxZpZK5DafXwAfE7nhT1ww+H0WgEdmGH4GmBDMwIqZ\ntTaz/xdKepFyqHCIVL5XiMy0PBd4D/hV0DU1kchMpguAPwOfE7mLHcDtQAGQY2YLgH8Hr0WqHZ1V\nJVKFzKyRu+8ysxZEjkJOC4qKSI2hs6pEqtbrZtYMSALuUdGQmkhHHCIiUiEa4xARkQpR4RARkQpR\n4RARkQpR4RARkQpR4RARkQr5/+ha/vg7V8VDAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x215c13e14a8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Q18\n",
    "Ylabel = Y.copy()\n",
    "Ylabel[Ylabel != 0] = -1\n",
    "Ylabel[Ylabel == 0] = 1\n",
    "logC = [-3, -2, -1, 0, 1]\n",
    "Nalpha = []\n",
    "\n",
    "for i in range(len(logC)):\n",
    "    clf = SVC(C=pow(10,logC[i]), kernel='rbf', gamma=100, shrinking=False)\n",
    "    clf.fit(X, Ylabel)\n",
    "    Nalpha.append(np.sum(clf.n_support_))\n",
    "# plot\n",
    "plt.plot(logC, Nalpha)\n",
    "plt.xlabel('logC')\n",
    "plt.ylabel('Nalpha')\n",
    "plt.title('Nalpha versus logC')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Q19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEWCAYAAACXGLsWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xl4XvV55//3x7LlfbfwvmETMDa7\nbGxISAJJa9IGSAJhCaZ0mjLTlvlNf51MhnRy0Zb0l1kyadM2yRTSZhLb7GlCndQJJQtJA5LxggEL\ns8jGsmR5kW0s75Yl3b8/zrF5ELL1yNbRo0f6vK5Ll8/yPefcOvKjW+f7Pec+igjMzMxOp1+hAzAz\ns57PycLMzDrkZGFmZh1ysjAzsw45WZiZWYecLMzMrENOFmY9hKQZkkJS/0LHYtaWk4VlTtIWSUck\nHcz5+noX7PfPJS3vihjN7PT8F4x1l49HxE8LHcSZktQ/IpoLHYdZofjKwgpKUj9JX5RUI2mXpKWS\nRqbrPiSprk37LZI+Imkx8KfAremVykvt7Ps+Sd9rs+xvJP1tOj1S0j9K2i5pm6S/lFSSrrtb0nOS\n/lrSXuDPJc2W9EtJjZJ2S3o8bfue7iNJz0r6bDrd7nZ5nJtJklZI2iupWtLv56wbLOm7kt6WtFHS\n53PP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KSTen6+6XtDrd5qGcp6GflfTXkn6l5H0S8yV9X9Kbkv4ybTND0muS/iHd/mFJ\nH5H0XNpuQdpugaTnlbzL4HlJ5xfqHFnf42Rh9l6fBC4FLiEp9fCVtLzDJ4EZwEXAZ4FFOdt8PSLm\nR8Q8YDDw2znrmiLiGuDvgX8G/giYB9wt6URF0NnA3wAXAxcAdwDvBz5H8rQ1JCUnromIy4D7gS93\n4fdsdlp9ptyHWSe8H3g0IlqAnZJ+CcxPlz8ZEa3ADkm/yNnmw5I+DwwBxgBVJJVJ4Z1aX68AVSdq\nQUnaTFL0bR/wVkS8ki6vAn4WESHpFZIEBUlRuO9KOo+kkuiArv/WzdrnKwuz9zrVy2LaXS5pEPBN\n4OaIuIikCumgnCYnqpO25kyfmO/fpk3bdrltvgT8Ir16+XibY5hlysnC7L1+Bdyq5AU4ZSSvcX0B\n+DXJC2/6SRpPUswQ3vmlvVvJOyNuziiukcC2dPrujI5h1i53Q5m91w9IxiNeIunu+XxE7JD0T8B1\nwAaS91ivIikxvk/St0i6mbaQlJ3Pwv8i6Yb6E+DnGR3DrF2uOmvWCZKGRcTBdGD6BeDqiNhR6LjM\nsuYrC7PO+VH6YpxS4EtOFNZX+MrCzMw65AFuMzPrkJOFmZl1yMnCzMw65GRhZmYdcrIwM7MO/f+D\nPbUq7ifdYgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x215c567db00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Q19\n",
    "Ylabel = Y.copy()\n",
    "Ylabel[Ylabel != 0] = -1\n",
    "Ylabel[Ylabel == 0] = 1\n",
    "Ytestlabel = Ytest.copy()\n",
    "Ytestlabel[Ytestlabel != 0] = -1\n",
    "Ytestlabel[Ytestlabel == 0] = 1\n",
    "logamma = [0, 1, 2, 3, 4]\n",
    "Eout = []\n",
    "\n",
    "for i in range(len(logamma)):\n",
    "    clf = SVC(C=0.1, kernel='rbf', gamma=pow(10,logamma[i]), shrinking=False)\n",
    "    clf.fit(X, Ylabel)\n",
    "    yhat = clf.predict(Xtest)\n",
    "    Eout.append(mistake(yhat, Ytestlabel))\n",
    "# plot\n",
    "plt.plot(logamma, Eout)\n",
    "plt.xlabel('logamma')\n",
    "plt.ylabel('Eout')\n",
    "plt.title('Eout versus logamma')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Q20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3XecFPX9x/HX5xrHwdGP3jvcgZST\nYscKSFOIYkGwoUlMTGJESABFMLEkiokaARuWKIoRELHQsYAUFbijHr0eR4fj+n1+f+zwc3M5uAVu\nd/Z2P8/HYx83szOz896B3c9O+35FVTHGGBO+ItwOYIwxxl1WCIwxJsxZITDGmDBnhcAYY8KcFQJj\njAlzVgiMMSbMWSEwpgwSkWEi8o3bOUxosEJgygwRuUFElojICRHJEJHFItLPx2UXich9/s5oTFlk\nhcCUCSIyCPgIeBuoD9QCxgJ93cxVHBGJdDuDMefCCkGYEZFOIvKj86v6IxGZJiITnGlVRWS282v7\niDNc32vZRSIyQUS+E5GTIvKpiFQXkfdE5LiIrBCRxl7zq4j8SkQ2O+sbLyLNRGSpM/+HIhJT0rpF\nRIDngfGq+pqqHlPVQlVdrKr3O/MME5FvRORvzvLbRKSXM+0p4HLgJSf3S8Vsly9E5KEiz60WkZud\n4dYiMldEDovIRhG5xWu+t0TkXyIyR0QygR4i0ltE1jnve4+I/NE7Z5H1qIg0d4aLXc6Hf9dL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6DZ8ejyoyT9H5vOcZDyx09jr6\nFlmHMX5lhcCEmyXAreLpoCQBT/eYy4Fv8HRIEiEitfA0fgc/fyEfFE+7/4P8lKsysMcZHuandRhT\nLDs0ZMLNJ3iO/6/GcwhmhKruF5GPgWuAFDx9/36PpynpoyIyBc+hn+14mhb3h2fxHBr6A7DAT+sw\npljW+qgxDhGpqKonnZO8y4FLVXW/27mM8TfbIzDmZ7OdjktigPFWBEy4sD0CY4wJc3ay2BhjwpwV\nAmOMCXNWCIwxJsxZITDGmDBnhcAYY8Lc/wEYkxy+KnQZYgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x215cc8ff780>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Q20\n",
    "Ylabel = Y.copy()\n",
    "Ylabel[Ylabel != 0] = -1\n",
    "Ylabel[Ylabel == 0] = 1\n",
    "logamma = [0, 1, 2, 3, 4]\n",
    "gammaCnt = [0, 0, 0, 0, 0]\n",
    "\n",
    "for i in range(100):\n",
    "    minEval = 1\n",
    "    for j in range(len(logamma)):\n",
    "        pos = np.random.permutation(row)\n",
    "        Xval = X[pos[0:1000], :]; Yval = Ylabel[pos[0:1000]]\n",
    "        Xtrain = X[pos[1000:], :]; Ytrain = Ylabel[pos[1000:]]\n",
    "        clf = SVC(C=0.1, kernel='rbf', gamma=pow(10,logamma[j]), shrinking=False)\n",
    "        clf.fit(Xtrain, Ytrain)\n",
    "        yhat = clf.predict(Xval)\n",
    "        Eval = mistake(yhat, Yval)\n",
    "        if Eval < minEval:\n",
    "            minEval = Eval\n",
    "            idx = j\n",
    "    gammaCnt[idx] += 1\n",
    "\n",
    "# plot\n",
    "plt.plot(logamma, gammaCnt)\n",
    "plt.xlabel('logamma')\n",
    "plt.ylabel('gammaCnt')\n",
    "plt.title('gammaCnt versus logamma')\n",
    "plt.show() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
